<template lang="html">
  <div class="main">
    <div class="main-body">
      <div class="title">
        我是标题
      </div>
      <div class="body">
        <div id="test_chart" class="chart">

        </div>
      </div>
    </div>
    <div class="main-menu">
      <div class="menu">
        <span @click="back">上一个</span>
        <span @click="back">返回</span>
        <span @click="back">下一个</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    back () {
      this.$router.go(-1);
    },
    draw () {
      let chart = this.$echarts.init(document.getElementById('test_chart'));
      let option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        legend: {
          data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        yAxis: {
          type: 'value'
        },
        xAxis: {
          type: 'category',
          data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        },
        color: ['#2FE0B6', '#01C853', '#FFD741', '#7C4DFF', '#3FC4FF'],
        series: [
          {
            name: '直接访问',
            type: 'bar',
            stack: '总量',
            label: {
              normal: {
                show: true,
                position: 'insideRight'
              }
            },
            data: [320, 302, 301, 334, 390, 330, 320]
          },
          {
            name: '邮件营销',
            type: 'bar',
            stack: '总量',
            label: {
              normal: {
                show: true,
                position: 'insideRight'
              }
            },
            data: [120, 132, 101, 134, 90, 230, 210]
          },
          {
            name: '联盟广告',
            type: 'bar',
            stack: '总量',
            label: {
              normal: {
                show: true,
                position: 'insideRight'
              }
            },
            data: [220, 182, 191, 234, 290, 330, 310]
          },
          {
            name: '视频广告',
            type: 'bar',
            stack: '总量',
            label: {
              normal: {
                show: true,
                position: 'insideRight'
              }
            },
            data: [150, 212, 201, 154, 190, 330, 410]
          },
          {
            name: '搜索引擎',
            type: 'bar',
            stack: '总量',
            label: {
              normal: {
                show: true,
                position: 'insideRight'
              }
            },
            data: [820, 832, 901, 934, 1290, 1330, 1320]
          }
        ]
      };
      chart.setOption(option);
    }
  },
  mounted () {
    setTimeout(_ => {
      this.draw();
    }, 200);
  }
};
</script>

<style lang="css" scoped>
.main {
  background-image: url('../../assets/bg_all_2.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  vertical-align: middle;
  justify-content: center;
  align-items: center;
  text-align: center;
  .main-body {
    width: 70%;
    height: 70%;
    box-shadow: 2px 6px 12px 2px rgba(0,0,0,.8);
    border-radius: 4px;
    border: 3px solid #ebeef5;
    background-color: rgba(255,255,255,.95);
    overflow: hidden;
    color: #303133;
    transition: .3s;
    .title {
      position: relative;
      height: 60px;
      line-height: 60px;
      text-align: left;
      margin-left: 20px;
      margin-right: 20px;
    }
    .title::after {
      content: '';
      position: absolute;
      width: 100%;
      height: 3px;
      top: 100%;
      left: 0px;
      overflow: hidden;
      border-top: 1px solid  rgba(150,150,150,.5);
      border-bottom: 1px solid  rgba(255,255,255,1);
      background-color: #eee;
    }
    .body {
      margin: 10px;
      height: 100%;
      width: 100%;
      .chart {
        width: 100%;
        height: 80%;
      }
    }
  }
  .main-menu {
    width: 70%;
    height: 50px;
    margin-top: 15px;
    position: relative;
    .menu {
      font-size: 20px;
      font-family: '微软雅黑';
      color: rgba(255,255,255,0.5);
      display: flex;
      flex-direction: row;
      vertical-align: middle;
      justify-content: center;
      align-items: center;
      text-align: center;
      height: 100%;
      margin-left: 30%;
      margin-right: 30%;
      span {
        display: block;
        flex: 1;
        cursor: pointer;
      }
      span:hover {
        transition: all .3s;
        font-size: 26px;
      }
    }
    .menu::after {
      content: '';
      position: absolute;
      width: 50%;
      height: 20px;
      top: 100%;
      overflow: hidden;
      background-size:100% 100%;
      background-image: url('../../assets/pic_back_tips.png');
    }
  }
}
</style>
